\(\int \frac {(A+B \cos (c+d x)) \sec (c+d x)}{a+a \cos (c+d x)} \, dx\) [43]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 29, antiderivative size = 44 \[ \int \frac {(A+B \cos (c+d x)) \sec (c+d x)}{a+a \cos (c+d x)} \, dx=\frac {A \text {arctanh}(\sin (c+d x))}{a d}-\frac {(A-B) \sin (c+d x)}{d (a+a \cos (c+d x))} \]

[Out]

A*arctanh(sin(d*x+c))/a/d-(A-B)*sin(d*x+c)/d/(a+a*cos(d*x+c))

Rubi [A] (verified)

Time = 0.09 (sec) , antiderivative size = 44, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.103, Rules used = {3057, 12, 3855} \[ \int \frac {(A+B \cos (c+d x)) \sec (c+d x)}{a+a \cos (c+d x)} \, dx=\frac {A \text {arctanh}(\sin (c+d x))}{a d}-\frac {(A-B) \sin (c+d x)}{d (a \cos (c+d x)+a)} \]

[In]

Int[((A + B*Cos[c + d*x])*Sec[c + d*x])/(a + a*Cos[c + d*x]),x]

[Out]

(A*ArcTanh[Sin[c + d*x]])/(a*d) - ((A - B)*Sin[c + d*x])/(d*(a + a*Cos[c + d*x]))

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 3057

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*sin[(e_
.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[b*(A*b - a*B)*Cos[e + f*x]*(a + b*Sin[e + f*x])^m*((c + d*Sin[e + f*
x])^(n + 1)/(a*f*(2*m + 1)*(b*c - a*d))), x] + Dist[1/(a*(2*m + 1)*(b*c - a*d)), Int[(a + b*Sin[e + f*x])^(m +
 1)*(c + d*Sin[e + f*x])^n*Simp[B*(a*c*m + b*d*(n + 1)) + A*(b*c*(m + 1) - a*d*(2*m + n + 2)) + d*(A*b - a*B)*
(m + n + 2)*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, n}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2
- b^2, 0] && NeQ[c^2 - d^2, 0] && LtQ[m, -2^(-1)] &&  !GtQ[n, 0] && IntegerQ[2*m] && (IntegerQ[2*n] || EqQ[c,
0])

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps \begin{align*} \text {integral}& = -\frac {(A-B) \sin (c+d x)}{d (a+a \cos (c+d x))}+\frac {\int a A \sec (c+d x) \, dx}{a^2} \\ & = -\frac {(A-B) \sin (c+d x)}{d (a+a \cos (c+d x))}+\frac {A \int \sec (c+d x) \, dx}{a} \\ & = \frac {A \text {arctanh}(\sin (c+d x))}{a d}-\frac {(A-B) \sin (c+d x)}{d (a+a \cos (c+d x))} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(109\) vs. \(2(44)=88\).

Time = 0.47 (sec) , antiderivative size = 109, normalized size of antiderivative = 2.48 \[ \int \frac {(A+B \cos (c+d x)) \sec (c+d x)}{a+a \cos (c+d x)} \, dx=\frac {2 \cos \left (\frac {1}{2} (c+d x)\right ) \left (A \cos \left (\frac {1}{2} (c+d x)\right ) \left (-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+\log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )+(-A+B) \sec \left (\frac {c}{2}\right ) \sin \left (\frac {d x}{2}\right )\right )}{a d (1+\cos (c+d x))} \]

[In]

Integrate[((A + B*Cos[c + d*x])*Sec[c + d*x])/(a + a*Cos[c + d*x]),x]

[Out]

(2*Cos[(c + d*x)/2]*(A*Cos[(c + d*x)/2]*(-Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]] + Log[Cos[(c + d*x)/2] + Si
n[(c + d*x)/2]]) + (-A + B)*Sec[c/2]*Sin[(d*x)/2]))/(a*d*(1 + Cos[c + d*x]))

Maple [A] (verified)

Time = 1.27 (sec) , antiderivative size = 54, normalized size of antiderivative = 1.23

method result size
parallelrisch \(\frac {-A \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+A \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (A -B \right )}{a d}\) \(54\)
derivativedivides \(\frac {-A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-A \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+A \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d a}\) \(61\)
default \(\frac {-A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-A \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+A \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d a}\) \(61\)
risch \(-\frac {2 i A}{d a \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}+\frac {2 i B}{d a \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}+\frac {A \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{a d}-\frac {A \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{a d}\) \(91\)
norman \(\frac {-\frac {\left (A -B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a d}-\frac {\left (A -B \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a d}}{1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}+\frac {A \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{a d}-\frac {A \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{a d}\) \(106\)

[In]

int((A+B*cos(d*x+c))*sec(d*x+c)/(a+cos(d*x+c)*a),x,method=_RETURNVERBOSE)

[Out]

(-A*ln(tan(1/2*d*x+1/2*c)-1)+A*ln(tan(1/2*d*x+1/2*c)+1)-tan(1/2*d*x+1/2*c)*(A-B))/a/d

Fricas [A] (verification not implemented)

none

Time = 0.32 (sec) , antiderivative size = 74, normalized size of antiderivative = 1.68 \[ \int \frac {(A+B \cos (c+d x)) \sec (c+d x)}{a+a \cos (c+d x)} \, dx=\frac {{\left (A \cos \left (d x + c\right ) + A\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (A \cos \left (d x + c\right ) + A\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (A - B\right )} \sin \left (d x + c\right )}{2 \, {\left (a d \cos \left (d x + c\right ) + a d\right )}} \]

[In]

integrate((A+B*cos(d*x+c))*sec(d*x+c)/(a+a*cos(d*x+c)),x, algorithm="fricas")

[Out]

1/2*((A*cos(d*x + c) + A)*log(sin(d*x + c) + 1) - (A*cos(d*x + c) + A)*log(-sin(d*x + c) + 1) - 2*(A - B)*sin(
d*x + c))/(a*d*cos(d*x + c) + a*d)

Sympy [F]

\[ \int \frac {(A+B \cos (c+d x)) \sec (c+d x)}{a+a \cos (c+d x)} \, dx=\frac {\int \frac {A \sec {\left (c + d x \right )}}{\cos {\left (c + d x \right )} + 1}\, dx + \int \frac {B \cos {\left (c + d x \right )} \sec {\left (c + d x \right )}}{\cos {\left (c + d x \right )} + 1}\, dx}{a} \]

[In]

integrate((A+B*cos(d*x+c))*sec(d*x+c)/(a+a*cos(d*x+c)),x)

[Out]

(Integral(A*sec(c + d*x)/(cos(c + d*x) + 1), x) + Integral(B*cos(c + d*x)*sec(c + d*x)/(cos(c + d*x) + 1), x))
/a

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 99 vs. \(2 (44) = 88\).

Time = 0.22 (sec) , antiderivative size = 99, normalized size of antiderivative = 2.25 \[ \int \frac {(A+B \cos (c+d x)) \sec (c+d x)}{a+a \cos (c+d x)} \, dx=\frac {A {\left (\frac {\log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a} - \frac {\log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a} - \frac {\sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}\right )} + \frac {B \sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}}{d} \]

[In]

integrate((A+B*cos(d*x+c))*sec(d*x+c)/(a+a*cos(d*x+c)),x, algorithm="maxima")

[Out]

(A*(log(sin(d*x + c)/(cos(d*x + c) + 1) + 1)/a - log(sin(d*x + c)/(cos(d*x + c) + 1) - 1)/a - sin(d*x + c)/(a*
(cos(d*x + c) + 1))) + B*sin(d*x + c)/(a*(cos(d*x + c) + 1)))/d

Giac [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 71, normalized size of antiderivative = 1.61 \[ \int \frac {(A+B \cos (c+d x)) \sec (c+d x)}{a+a \cos (c+d x)} \, dx=\frac {\frac {A \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{a} - \frac {A \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{a} - \frac {A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a}}{d} \]

[In]

integrate((A+B*cos(d*x+c))*sec(d*x+c)/(a+a*cos(d*x+c)),x, algorithm="giac")

[Out]

(A*log(abs(tan(1/2*d*x + 1/2*c) + 1))/a - A*log(abs(tan(1/2*d*x + 1/2*c) - 1))/a - (A*tan(1/2*d*x + 1/2*c) - B
*tan(1/2*d*x + 1/2*c))/a)/d

Mupad [B] (verification not implemented)

Time = 0.26 (sec) , antiderivative size = 42, normalized size of antiderivative = 0.95 \[ \int \frac {(A+B \cos (c+d x)) \sec (c+d x)}{a+a \cos (c+d x)} \, dx=\frac {2\,A\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{a\,d}-\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (A-B\right )}{a\,d} \]

[In]

int((A + B*cos(c + d*x))/(cos(c + d*x)*(a + a*cos(c + d*x))),x)

[Out]

(2*A*atanh(tan(c/2 + (d*x)/2)))/(a*d) - (tan(c/2 + (d*x)/2)*(A - B))/(a*d)